<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/jsp/struts/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="style/home.css" type="text/css">
<script language=javascript src="script/prototype.js"></script>
<script language=javascript src="script/common.js"></script>
<STYLE TYPE="text/css">
#categoryList {
border: 2px broove #eee;
margin-top: 1em;
line-height:1.8em;
}
#categoryList th{
text-align:center
}
#categoryList td{
border: 1px solid #eee;
}
#categoryList a{
font-size:1em;
color:#330099
}

</STYLE>
<script language="Javascript">
function submitForm(method) {
	location.href="category.htm?method=" + method;
}
</script>
</head>
<body>
<div id="content">
<div id="content_inner">
<display:table htmlId="categoryList" name="categoryList" sort="list" 
     class="its" id="category" requestURI="category.htm">
<display:setProperty name="basic.empty.showtable" value="true" />
<display:setProperty name="basic.msg.empty_list_row" value="<tr class='empty'><td colspan='{0}'>没有记录</td></tr>"/>
<display:column  style="width:5%; text-align:center" headerClass="sortable">
<INPUT TYPE="checkbox" NAME="categoryID" ID="categoryID" value="${category.categoryID}" >
</display:column>
<display:column title="类名" style="width:15%;text-align:left;white-space:nowrap" sortable="true" headerClass="sortable">
${category.categoryName}
</display:column>
<display:column property="description" title="描述"  style="width:30%;" headerClass="sortable"/>
<display:column title="类别"  style="width:20%;" sortable="true" headerClass="sortable">
<c:if test="${category.categoryType == 1}">
${category.categoryType}.任务分类
</c:if>
<c:if test="${category.categoryType == 2}">
${category.categoryType}.文章分类
</c:if>
<c:if test="${category.categoryType == 3}">
${category.categoryType}.图书分类
</c:if>
</display:column>
<display:column title="用户" style="width:10%;" sortable="true" headerClass="sortable">
<c:choose>
<c:when test="${category.userID == 0}">
全体用户
</c:when>
<c:otherwise>
用户${category.userID}
</c:otherwise>
</c:choose>
</display:column>
<display:column style="width:20%;text-align:center" 
title="<input type='button' onclick=\"submitForm('add')\" value='添加分类'/>">
<a href="category.htm?method=edit&categoryID=${category.categoryID}&categoryType=${param.categoryType}" class="icon_btn pic_edit" title="编辑分类"><span>编辑分类</span></a>
<a href="category.htm?method=delete&categoryID=${category.categoryID}&categoryType=${param.categoryType}" class="icon_btn pic_delete" title="删除分类"><span>删除分类</span></a>
</display:column>
</display:table>

<script  language="Javascript">
var tmpIn = document.createElement("input");
tmpIn.type="text";
var curCell;

function edit(event) {
    if(event==null) {
        curCell = window.event.srcElement;
    } else {
        curCell = event.target;
    }

    tmpIn.value = curCell.innerHTML;
    tmpIn.onblur = end;
    curCell.innerHTML = "";
    curCell.appendChild(tmpIn);
}

function end() {
    curCell.innerHTML = tmpIn.value;
}

//document.getElementById("categoryList").ondblclick = edit;


</script>
</div></div>

</body>
</html>